<?php

namespace App\Http\Controllers\Shop;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
    use AuthenticatesUsers;
    protected $redirectTo = '/shop';

    protected function __construct()
    {
    	$this -> middleware('guest.shop',['except' => 'logout']);
    }
    /**
     * 显示后台登陆模板
     * @return [type] [description]
     */
    public function showLoginForm()
    {
    	return view('shop.login');
    }
    protected function guard()
    {
    	return auth() -> guard('shop');
    }
    public function username()
    {
    	return 'name';
    }
    public function logout()
    {
    	$this -> guard() -> logout();
    	$request->session()->forget($this->guard()->getName());
    	$request->session()->regenerate();
    	return redirect('/shop');
    }
}
